<template>
	<view>
		<!-- 普通用户 -->
		<uni-card >
			<!-- <text>这是一个基础卡片示例，内容较少，此示例展示了一个没有任何属性不带阴影的卡片。</text> -->
			<view class="content" @click="cardDetails(data)">
				<!-- 右侧内容 -->
				<view class="right_content">
					<!-- 公司名称名称 -->
					<view class="right_title">
						{{data.company}}
					</view>
					<!-- 申报人 -->
					<view class="right_address rightlr">
						<view class="left">申报人：</view>
						<view class="right">{{data.apply_by}}</view>
					</view>
					<!-- 手机号 -->
					<view class="right_address rightlr">
						<view class="left">地址：</view>
						<view class="right">{{data.apply_phone}}</view>
					</view>
					<!-- 地址 -->
					<!-- <view class="right_address rightlr">
						<view class="left">地址：</view>
						<view class="right">{{data.apply_address}}</view>
					</view> -->
					<!-- 编号 -->
					<!-- <view class="right_id rightlr">
						<view class="left">工单编号：</view>
						<view class="right">{{data.apply_id}}</view>
					</view> -->
					<!-- 时间 -->
					<view class="right_time rightlr">
						<view class="left">申报时间：</view>
						<view class="right">{{data.add_time}}</view>
					</view>
					
					<!-- <view v-if="data.status==2" class="reason">
						<view class="right">/*{{data.reason}}*/点击下方按钮重新提交信息</view>
					</view> -->
					<!-- 未通过原因 -->
				</view>
			</view>
			<u-button v-if="data.pass_flag == 2" @click="edit(data)" >修改资料</u-button>
		</uni-card>
	</view>
</template>

<script>
	export default {
		props: ['data', 'isUser', 'userInfo'],
		methods: {
			/**
			 * @param {Object} item 数据
			 * 
			 */
			edit(item){
				uni.navigateTo({
					url: "/components/ApplicationProcess/components/card/record/index",
					success: res => {
						console.log('res', res)
						res.eventChannel.emit('record', item)
					},
					fail: (fail) => {
						console.log('fail', fail)
					}
				})
			},
			/**
			 * @param {Object} data
			 * 详情页
			 * res.eventChannel.emit('acceptDataFromOpenerPage',data )//通过res.eventChannel.emit传递参数
			 */
			cardDetails(data) {
				uni.navigateTo({
					url: "/components/ApplicationProcess/components/details/index",
					success: res => {
						console.log('res', res)
						res.eventChannel.emit('acceptDataFromOpenerPage', this.data)
						res.eventChannel.emit('isUser', this.isUser)
					},
					fail: (fail) => {
						console.log('fail', fail)
					}
				});
			},
		},
	}
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;

		.right_content {
			width: 100%;

			.right_title {
				font-weight: 700;
				font-size: 30rpx;
				width: 90%;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}

			.right_status {
				display: flex;
			}

			.rightlr {
				display: flex;

				.left {
					color: black;
				}

				.right {
					color: #999999;

				}
			}

			.reason {
				width: 100%;
				color: #ef3e02;
				;
			}
		}
	}
</style>